package com.caifu.controller.baseData;

import com.caifu.controller.AbstractController;
import com.caifu.pojo.SysUser;
import com.caifu.pojo.YlCheckInfo;
import com.caifu.service.ICheckService;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
* 
* 功能描述：查房信息管理
*
* @Author  GZ
* @Date   2020/11/10 14:43
*/
@Controller
@RequestMapping("/baseData/check")
public class CheckController extends AbstractController {

    @Autowired
    private ICheckService checkService;

    /**
     *
     * 功能描述：查询查房信息列表
     *
     * @Author  GZ
     * @Date   2020/11/9 15:28
     */
    @RequestMapping("checkList")
    public String feeList(){

        return "baseData/checkList";
    }
    /**
     *
     * 功能描述：查询查房信息列表
     *
     * @Author  GZ
     * @Date   2020/11/9 15:33
     */
    @RequestMapping("obtainCheckData")
    @ResponseBody
    public JSONObject obtainFeeData(String checkType){
        SysUser user =getUser();
        try {
            return checkService.queryCheckInfoList(checkType,user);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     *
     * 功能描述：保存查房信息
     *
     * @Author  GZ
     * @Date   2020/11/9 15:34
     */
    @RequestMapping("saveCheckInfo")
    @ResponseBody
    public JSONObject saveFeeInfo(YlCheckInfo checkInfo){
        SysUser user =getUser();
        try {
            return checkService.saveCheckInfo(checkInfo,user);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     *
     * 功能描述：查询查房信息详情
     *
     * @Author  GZ
     * @Date   2020/11/10 13:57
     */
    @RequestMapping("queryCheckInfoDetail")
    @ResponseBody
    public JSONObject queryCheckInfoDetail(String checkNo){
        try {
            return checkService.queryCheckInfoDetail(checkNo);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     *
     * 功能描述：修改查房信息
     *
     * @Author  GZ
     * @Date   2020/11/10 13:59
     */
    @RequestMapping("updateCheckInfo")
    @ResponseBody
    public JSONObject updateCheckInfo(YlCheckInfo checkInfo){
        try {
            return checkService.updateCheckInfo(checkInfo);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     *
     * 功能描述：删除查房信息
     *
     * @Author  GZ
     * @Date   2020/11/10 13:51
     */
    @RequestMapping("deleteCheckInfo")
    @ResponseBody
    public JSONObject deleteCheckInfo(String checkNo){
        try {
            return checkService.deleteCheckInfo(checkNo);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
